package com.qcxy.gzy.activity.base;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;

public abstract class HiddenActivity extends Activity {
    protected boolean isAlive = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        isAlive = true;
    }

    // Activity创建或者从后台重新回到前台时被调用
    @Override
    protected void onStart() {
        super.onStart();
    }

    // Activity从后台重新回到前台时被调用
    @Override
    protected void onRestart() {
        super.onRestart();
    }

    /**
     * 隐藏虚拟键
     */
    // Activity创建或者从被覆盖、后台重新回到前台时被调用
    @Override
    protected void onResume() {
        super.onResume();
        // 发送隐藏虚拟键的广播
        View decorView = getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                | View.SYSTEM_UI_FLAG_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOptions);
    }

    // Activity被覆盖到下面或者锁屏时被调用 
    @Override
    protected void onPause() {
        super.onPause();
    }

    // 退出当前Activity或者跳转到新Activity时被调用  
    @Override
    protected void onStop() {
        super.onStop();
    }

    // Activity被系统杀死时被调用.
    @Override
    protected void onDestroy() {
        super.onDestroy();
        isAlive = false;
    }

}
